package com.acmen.easyapi.model;

import com.acmen.easyapi.annotation.ResParam;

import java.util.Collections;
import java.util.List;

/**
 * @author acmen
 * @param <T>
 */
public class CustomizePage<T> {
    @ResParam(label = "总记录数")
    private long total;
    @ResParam(label = "页面大小")
    private long size = 20;
    @ResParam(label = "当前页码")
    private long current = 1;
    @ResParam(label = "记录集合")
    private List<T> records;

    public CustomizePage() {
    }

    public CustomizePage(List<T> records, long size, long total) {
        this.records = Collections.emptyList();
        this.total = 0L;
        if (size > 1L) {
            this.size = size;
        }
        this.records = records;
        this.total = total;
    }

    public List<T> getRecords() {
        return records;
    }
    public CustomizePage<T> setRecords(List<T> records) {
        this.records = records;
        return this;
    }
    public long getTotal() {
        return total;
    }
    public CustomizePage<T> setTotal(long total) {
        this.total = total;
        return this;
    }
    public long getSize() {
        return size;
    }
    public CustomizePage<T> setSize(long size) {
        this.size = size;
        return this;
    }
    public long getCurrent() {
        return current;
    }
    public CustomizePage<T> setCurrent(long current) {
        this.current = current;
        return this;
    }
}
